﻿@{
    var menusRight = GetMenus("RightColumn", CurrentLanguage);
    var zoneRightWidgets = GetWebSiteWidgets(CurrentLayout, "RightSidebar");

    if (menusRight.Count > 0 || zoneRightWidgets.Count > 0)
    {
        HasRightColumn = true;
        BodyWidth = BodyWidth - 2;
    }
}


@if (HasRightColumn)
{
    <div class="col-sm-2 pull-right">
        <!-- Right Menu Start -->
        @if (menusRight != null && menusRight.Count > 0)
        {
            <div class="col-md-12">
                @foreach (var item in menusRight)
                {
                    foreach (var menuItem in item.MenuItems)
                    {
                        <a href="@menuItem.Url">@menuItem.Name</a><br />
                        foreach (var mi2 in menuItem.Childrens)
                        {
                            <span>&nbsp;&nbsp;--</span><a href="@mi2.Url">@mi2.Name</a><br />
                            foreach (var mi3 in mi2.Childrens)
                            {
                                <span>&nbsp;&nbsp;&nbsp;&nbsp;--</span><a href="@mi3.Url">@mi3.Name</a><br />
                                foreach (var mi4 in mi3.Childrens)
                                {
                                    <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--</span><a href="@mi4.Url">@mi4.Name</a><br />
                                }
                            }
                        }
                    }
                }
            </div>
            <div class="clearfix"></div>
        }
        <!-- Right Menu End -->
        <!-- Right Sidebar Start -->
        @if (zoneRightWidgets != null && zoneRightWidgets.Count > 0)
        {
            <div class="row">
                @foreach (var item in zoneRightWidgets)
                {
                    var widget = item.Widget;
                    widget.Init(item.Id);
                    if (string.IsNullOrEmpty(widget.Language) || string.IsNullOrEmpty(CurrentLanguage) || CurrentLanguage == widget.Language)
                    {
                        if (widget.DisplayTitle != "" || widget.Footer != "")
                        {
                            <div class='panel panel-default'>
                                @if (widget.DisplayTitle != "")
                                {
                                    <div class='panel-heading'>
                                        @_T[widget.DisplayTitle]
                                    </div>
                                }
                                <div class='panel-body'>
                                    @Html.Raw(widget.RenderBody())
                                </div>
                                @if (widget.Footer != "")
                                {
                                    <div class='panel-footer'>
                                        @_T[widget.Footer]
                                    </div>
                                }
                            </div>
                        }
                        else
                        {
                            <div>
                                @Html.Raw(widget.RenderBody())
                            </div>
                        }
                    }
                }
            </div>
        }
        <!-- Right Sidebar End -->
    </div>
}
